package com.eastfair.home.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.eastfair.boot.request.PageParams;
import com.eastfair.builder.dto.ExhibitorDTO;
import com.eastfair.builder.vo.ExhibitorVO;
import com.eastfair.core.base.R;
import com.eastfair.home.service.HomeServiceProviderSpaceService;
import com.eastfair.venueservice.dto.ServiceProviderSpaceDTO;
import com.eastfair.venueservice.dto.ServiceProviderSpaceQuery;
import com.eastfair.venueservice.vo.ServiceCategoryVO;
import com.eastfair.venueservice.vo.ServiceProviderSpaceVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 主场 服务商，展厅,展位关系 REST API.
 *
 * @author dqq
 * @date 2022 /11/8
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/homeServiceProviderSpec")
public class HomeServiceProviderSpaceController {

    @Resource
    private HomeServiceProviderSpaceService homeServiceProviderSpaceService;

    /**
     * 查询服务商使用展厅
     *
     * @param query 查询服务商使用展厅
     * @return R
     */
    @ApiOperation(value = "查询服务商使用展厅", notes = "查询服务商使用展厅")
    @PostMapping("/queryServiceProviderSpace")
    public R<List<ServiceProviderSpaceVO>> queryServiceProviderSpace(@RequestBody ServiceProviderSpaceQuery query) {
        log.info("queryServiceProviderSpace - 查询服务商使用展厅, query={}", query);
        List<ServiceProviderSpaceVO> list = homeServiceProviderSpaceService.queryServiceProviderSpace(query);
        return R.successDef(list);
    }

    /**
     * 通过展会，主场，展厅查询展位
     *
     * @param query 查询服务商使用展厅
     * @return R
     */
    @ApiOperation(value = "查询服务商使用展位", notes = "通过展会，主场，展厅查询展位")
    @PostMapping("/queryServiceProviderSite")
    public R<Page<ExhibitorVO>> queryServiceProviderSite(@RequestBody PageParams<ExhibitorDTO> query) {
        log.info("queryServiceProviderSite - 查询服务商使用展位, query={}", query);
        return homeServiceProviderSpaceService.queryServiceProviderSite(query);
    }




}